package com.lifang.framework.aop.aspectj;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

import java.lang.reflect.Method;

/**
 * AfterAdvice(后置通知)执行器
 */
public class AspectJAfterAdvice extends AbstractAspectJAdvice implements MethodInterceptor {

    public AspectJAfterAdvice(Method aspectJAdviceMethod, AspectJExpressionPointcut pointcut) {
        super(aspectJAdviceMethod, pointcut);
    }

    @Override
    public int getOrder() {
        return 5;
    }

    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable {
        Object retVal = invocation.proceed();
        invokeAdviceMethod(retVal);
        return retVal;
    }
}
